<?php


namespace app\Utils;

use app\models\CronTask;
use Swoole\Table;
class TaskUtil
{
    public static $swoole_table;
    public static $column = [
        "minute" => [Table::TYPE_STRING, 12],
        "second" => [Table::TYPE_STRING, 12],
        "id" => [Table::TYPE_STRING, 20],
        "runId" => [Table::TYPE_STRING, 20],
        "runStatus" => [Table::TYPE_STRING, 2],
    ];

    /**
     * 创建配置表
     */
    public static function init()
    {
        self::$table = new Table(TASKS_SIZE*2);
        foreach (self::$column as $key => $v) {
            self::$table->column($key, $v[0], $v[1]);
        }
        self::$table->create();
    }

    //任务列表心跳
    public static function taskLive()
    {
        $cron = new CronTask();
        $task_list = $cron->getTask();
        if(count($task_list) > 0){

            $time = time();
            foreach ($task_list as $id => $task)
            {



            }

        }
    }

}